import time
from multiprocessing import Pool
from os import cpu_count


def run(i:int):
    print("我是子进程", i)
    time.sleep(5)
    pass


if __name__ == '__main__':
    p = Pool(3) # 传数限制并发数
    print("cpu cunt", str(cpu_count()))
    p.map(run, range(10))
    p.close() # 关闭池
    p.join() # 阻塞等待
    print("over")